package com.its.service.impl;

import com.its.mapper.UserMapper;
import com.its.pojo.User;
import com.its.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.its.util.HttpStatusEnum;
import com.its.util.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 朱厚强
 * @since 2024年01月17日
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;
    @Override
    public Result getByIds(String id) {
//        User byId = userService.getById(id);
        User user = userMapper.selectById(id);
        if (user != null){
            return Result.ok().code(HttpStatusEnum.SUCCESS.getCode()).data(user).message("查询成功");
        }else {
            return Result.error().code(HttpStatusEnum.ERROR.getCode()).data(user).message("查询失败");
        }
    }
}
